home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93b.txt
/
000044_icon-group-sender _Tue Apr 27 02:15:01 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-06-16
|
2KB
Received: by cheltenham.cs.arizona.edu; Thu, 29 Apr 1993 12:08:29 MST
Date: 27 Apr 93 02:15:01 GMT
From: darwin.sura.net!wupost!usc!sdd.hp.com!cs.utexas.edu!uwm.edu!linac!uchinews!ellis!goer@gatech.edu (Richard L. Goerwitz)
Organization: University of Chicago
Subject: Re: Is this passable code?
Message-Id: <1993Apr27.021501.19198@midway.uchicago.edu>
References: <9304260508.AA21290@internal.apple.com>
Sender: icon-group-request@cs.arizona.edu
To: icon-group@cs.arizona.edu
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
nevin@apple.com (Nevin ":-]" Liber) writes:
>
>procedure main(LArguments)
>etc.
every insert(SAnagrams, Permute(map(!LArguments)))
This shows precisely how Icon's control mechanisms ought to be used.
!LArguments generates everything in the arg list. Permute is also a
generator. The keyword "every" indicates that all possible results
should be fetched, just as if this were Prolog :-).
>suspend sString[iPos := 1 to *sString] ||
> Permute(sString[1:iPos] || sString[iPos+1:0])
This is nice, too. Uses "suspend" to trigger backtracking - which
is then fed into the recursion to produce a full set of permutations.
Nevin: Where did you learn your Icon? Pretty idiomatic stuff. You
say it's 20 lines, but in fact most of that is whitespace or extra
local declarations (e.g. local x local y = local x,y). You did the
important stuff in about 8 lines....
--
-Richard L. Goerwitz goer%midway@uchicago.bitnet
goer@midway.uchicago.edu rutgers!oddjob!ellis!goer